<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="css/mui.min.css" rel="stylesheet" />

		<style>
			ul {
				font-size: 14px;
				color: #8f8f94;
			}
			
			.mui-btn {
				padding: 10px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="padding-right: 15px;">
			<h1 class="mui-title">登录模板</h1>
			<button id='setting' class=" mui-pull-right mui-btn-link">设置</button>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded">
				<p>
					您好 <span id='account'></span>，您已成功登录。
				</p>
				<button id="button_get_cur_player" type="button" class="mui-btn mui-btn-block">查看当前在线玩家</button>
				<button id="button_test_next_color" type="button" class="mui-btn mui-btn-primary mui-btn-block">测试：确定下一花色</button>
				<button id="button_update_user_gold" type="button" class="mui-btn mui-btn-success mui-btn-block">玩家上下分</button>
				<button id="button_get_awaypool_info"  type="button" class="mui-btn mui-btn-warning mui-btn-block">查看奖池信息</button>
				<button type="button" class="mui-btn mui-btn-danger mui-btn-block">Block button</button>

				<!--<button  class="mui-btn mui-btn-block mui-btn-primary">设置</button>-->
				<!--
				<button id='exit' class="mui-btn mui-btn-block mui-btn-green">关闭</button>
                <button id='logout' class="mui-btn mui-btn-red mui-btn-block">注销登录</button>
                -->
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/app.js"></script>
		<script>
			(function($, doc) {
				$.init();
				var settings = app.getSettings();
				var account = doc.getElementById('account');
				//
				window.addEventListener('show', function() {
					var state = app.getState();
					account.innerText = state.account;
				}, false);
				$.plusReady(function() {
					var settingPage = $.preload({
						"id": 'setting',
						"url": 'setting.html'
					});
					//设置
					var settingButton = doc.getElementById('setting');
					//settingButton.style.display = settings.autoLogin ? 'block' : 'none';
					settingButton.addEventListener('tap', function(event) {
						$.openWindow({
							id: 'setting',
							show: {
								aniShow: 'pop-in'
							},
							styles: {
								popGesture: 'hide'
							},
							waiting: {
								autoShow: false
							}
						});
					});
					//--
					$.oldBack = mui.back;
					var backButtonPress = 0;
					$.back = function(event) {
						backButtonPress++;
						if (backButtonPress > 1) {
							plus.runtime.quit();
						} else {
							plus.nativeUI.toast('再按一次退出应用');
						}
						setTimeout(function() {
							backButtonPress = 0;
						}, 1000);
						return false;
					};
					// wxhh content**********************************************************************
					// 跳转至玩家列表页面
					var toGetCurPlayer = function() {
						//打开关于页面
						mui.openWindow({
							url: 'examples/info.html',
							id: 'info'
						});
					};
					//查看当前在线玩家

					var btn_get_cur_player = doc.getElementById("button_get_cur_player")
					btn_get_cur_player.addEventListener("tap", function(event) {
						$.openWindow({
							url: 'sub_page/player_list_main.html',
							id: 'player_list_main.html',
							preload: true,
							show: {
								aniShow: 'pop-in'
							},
							styles: {
								popGesture: 'hide'
							},
							waiting: {
								autoShow: false
							}
						});
					})

					// 测试下一个花色************************************************************************
					var btn_test_next_color = doc.getElementById("button_test_next_color")
					btn_test_next_color.addEventListener("tap", function(event) {
						$.openWindow({
							url: 'sub_page/test_next_color.html',
							id: 'test_next_color.html',
							preload: true,
							show: {
								aniShow: 'pop-in'
							},
							styles: {
								popGesture: 'hide'
							},
							waiting: {
								autoShow: false
							}
						});
					})

					//玩家上下分************************************************************************
					var button_update_user_gold = doc.getElementById("button_update_user_gold");
					button_update_user_gold.addEventListener("tap", function(event) {
						$.openWindow({
							url: 'sub_page/add_gold_for_user.html',
							id: 'add_gold_for_user.html',
							preload: true,
							show: {
								aniShow: 'pop-in'
							},
							styles: {
								popGesture: 'hide'
							},
							waiting: {
								autoShow: false
							}
						});
					});
					
					//查看奖池信息************************************************************************
					
					var button_get_awaypool_info = doc.getElementById("button_get_awaypool_info");
					button_get_awaypool_info.addEventListener("tap", function(event) {

						$.openWindow({
							url: 'sub_page/get_cur_away_pool.html',
							id: 'get_cur_away_pool.html',
							preload: true,
							show: {
								aniShow: 'pop-in'
							},
							styles: {
								popGesture: 'hide'
							},
							waiting: {
								autoShow: false
							}
						});
					});
					
					
					
				});
			}(mui, document));
		</script>
	</body>

</html>